<script setup lang='ts'>
  import { onMounted, reactive, watch } from 'vue';
  import { statisticsApi } from '@/api/controller';
  import { Toastloading } from '@/utils/public';
  import { useRoute } from 'vue-router';
  const $route = useRoute()
  const action = reactive({
    type:1,
    list:[] as any[],
  })
  const getList = async()=> {
    const loading = Toastloading()
    const res = await statisticsApi.sendgiftlevel({
      type:action.type
    })
    loading.close()
    action.list = res.data || []
  }
  const getRouteMetaType = ()=>{
    action.type = $route.meta.type as number
    getList()
  }
  watch($route,(res:any)=>{
    if(res.meta.type > -1) {
      getRouteMetaType()
    }
  })
  onMounted(()=>{
    getRouteMetaType()
  })
</script>

<template>
  <div class="xm-content">
    <el-table
      class="xm-TableCenter"
      :data="action.list"
      border
      show-summary>
      <el-table-column lazy min-width="120" prop="all_user" :label="['','DAV','上麦主播数','主播人数'][action.type]" />
      <el-table-column min-width="120" prop="create_time" label="日期" />
      <el-table-column min-width="120" prop="firstLevel" label="关卡1总人数" />
      <el-table-column min-width="120" prop="sencondLevel" label="关卡2总人数" />
      <el-table-column min-width="120" prop="thirdLevel" label="关卡3总人数" />
      <el-table-column min-width="120" prop="FourLevel" label="关卡4总人数" />
      <el-table-column min-width="120" prop="fiveLevel" label="关卡5总人数" />
    </el-table>
  </div>
</template>